<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>注册 {$site_name}</title>
	<meta name="keywords" content="{$site_seo_keywords}" />
	<meta name="description" content="{$site_seo_description}">
	<tc_include file="Public:head" />
	<link href="__TMPL__Public/assets/css/user-index.css" rel="stylesheet">
</head>
<body>
<style type="text/css">
	.verify{
		position:relative;
	}
	.verify #verify-error{
		position:absolute;
		top:40px;
		left:0;
	}
</style>
<script type="text/javascript">
	jQuery.validator.addMethod("email", function(value, element) {   
		var email = /^([a-zA-Z0-9_\.]+)@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/;
		return this.optional(element) || (email.test(value));
	}, "请正确填写您的邮箱地址");
</script>
<script>
$.validator.setDefaults({
    submitHandler: function() {
      alert("提交事件!");
    }
});
$().ready(function() {
// 在键盘按下并释放及提交后验证提交表单
  $("#val-form").validate({
	    rules: {	     	      
	      password: {
	        required: true,
	        minlength: 6
	      },
	      repassword: {
	        required: true,
	        minlength: 6,
	        equalTo: "#password"
	      },
	      email: {
	        required: true,
	        email: true
	      },
		  verify:{
			required: true,
			remote: {
				url: "{:U('user/register/valCode')}",     //后台处理程序
				type: "post",               //数据发送方式
				dataType: "json",           //接受数据格式   
				data: {                     //要传递的数据
					verify: function() {
						return $("#verify").val();
					}
				}
			}
		  }
	    },
	    messages: {	     
	      username: {
	        required: "请输入用户名",
	        minlength: "用户名必需由两个字母组成"
	      },
	      password: {
	        required: "请输入密码",
	        minlength: "密码长度不能小于 6 个字符"
	      },
	      repassword: {
	        required: "请输入密码",
	        minlength: "密码长度不能小于 6 个字符",
	        equalTo: "两次密码输入不一致"
	      },
	      email:{
			required: "邮箱不能为空",
			email:"请输入一个正确的邮箱地址",
		  },
		  verify:{
			required: "验证码不能为空",	
			remote:"验证码错误",
		  }
	    }
		
	});
});
</script>
	<div id="body_wrap">
        <div class="login_wrap">
			<div class="u-header">
				<div class="login-top k-row">
					<div class="logo">
						<a title="{$site_name}" href="__ROOT__/" class="logo_img"><img src="__TMPL__Public/assets/images/newLogo.png" alt="" /></a>
						<div class="hava-account fr">
						已有账号？<a href="{:leuu('user/login/index')}">立即登录</a>
						</div>
					</div>
					
					<div class="clear"></div>
				</div>
			</div>           
            <div class="reg-content">
				<div class="k-row">
					<div class="reg-bg">
						<div class="reg-head">
							<h3 class="head-title">注册</h3>
						</div>
						<form class="form-horizontal " id="val-form" action="{:U('user/register/doregister')}" method="post">
							<div class="main-box">
								<div class="ui-sign-item lg_name">
									<input type="text" maxlength="32" class="ui-input" id="email" name="email" placeholder="邮箱">
								</div>
								<div class="ui-sign-item lg_pwd">
									<input type="password" maxlength="32" class="ui-input" id="password" name="password" placeholder="6-16位密码">
								</div>
								<div class="ui-sign-item lg_pwd">
									<input type="password" maxlength="32" class="ui-input" id="repassword" name="repassword" placeholder="再次输入密码">
								</div>
								<div class="ui-sign-item verify">
									<input type="text" maxlength="32" id="verify" class="ui-input" name="verify" placeholder="输入验证码">
									{:sp_verifycode_img('length=4&font_size=14&width=100&height=34&charset=1234567890&use_noise=1&use_curve=0')}
									<div class="clear"></div>
								</div>
								<div class="regbox">
									<button class="btn btn-primary js-ajax-submit" type="submit" data-wait="1500">注册</button>
								</div>
							</div>
							<div class="clear"></div>
						</form>
					</div>
				</div>
			</div>    
        </div>
    </div>
	<tc_include file="Public:scripts" />
	
</body>
</html>